/**
 * 
 */
package com.jie.eclipse.pan.config.toolbar;

import com.jie.eclipse.pan.config.BaseConfig;
import com.jie.eclipse.pan.config.BasePageConfig;
import com.jie.eclipse.pan.xml.XMLNode;

/**
 * @author yanjie
 *
 */
public class ToolbarConfig extends BaseConfig{
	BasePageConfig pageConfig = null;
	@Override
	public String getNodeName() {
		return "TOOLBAR";
	}
	
	/**
	 * 
	 */
	public ToolbarConfig() {
		this.spsv(BaseConfig.TAG_LABLE, "工具栏");
	}
	
	@Override
	public void FillXmlNode(XMLNode toolbar) {
		//super.FillXmlNode(toolbar);
		toolbar.setNodeName(this.getNodeName());
		toolbar.spsv(BaseConfig.TAG_LABLE, "工具栏");
		
		BasePageConfig pageConfig = this.getPageConfig();
		ToolbarConfig defaultConfig = new ToolbarConfig();
		defaultConfig.loadConfig(pageConfig.getBaseWizard().getPanGenerator().getDefaultToolbar(pageConfig.getTpType()));
		String[] actions = {"new","search","save","cancel","delete","copy","start","check","export","print","help"};
		
		for (int i = 0; i < actions.length; i++) {
			String action = actions[i];
			
			if(this.gpbv(action+"Disabled",true)){
				toolbar.SetValue(action+"Disabled", String.valueOf(!this.gpbv(action+"Disabled",false)));
				toolbar.SetValue(action+"Confirm", this.gpsv(action+"Confirm"));
				toolbar.SetValue(action+"Enab", this.gpsv(action+"Enab"));
			}
		}
	}
	
	public BasePageConfig getPageConfig() {
		return pageConfig;
	}

	public void setPageConfig(BasePageConfig pageConfig) {
		this.pageConfig = pageConfig;
	}
	
	/* (non-Javadoc)
	 * @see com.jie.eclipse.pan.xml.XMLConfig#CreateCloneObject()
	 */
	@Override
	protected Object CreateCloneObject() {
		return new ToolbarConfig();
	}
}
